package com.gopay.common.exception;

import com.gopay.common.constants.proccode.ProcCodeEnum;
import org.apache.commons.lang.StringUtils;

/**
 * 审批异常
 * 
 * @ApprovalException.java
 * @author LEO
 * @2012-12-20 下午5:48:10 www.gopay.com.cn Inc.All rights reserved.
 */
public class ApprovalException extends GopayException {

    /**
     * 
     */
    private static final long serialVersionUID = -2648637534218423444L;

    /**
     * 审批流程编号
     */
    private Integer approvalId;

    public ApprovalException() {
        super();
    }

    public ApprovalException(String errCode1) {
        super(errCode1);
    }

    public ApprovalException(ProcCodeEnum procCodeEnum) {
        super(procCodeEnum);
    }

    public ApprovalException(ProcCodeEnum procCodeEnum , String debugMsg) {
        super(procCodeEnum,debugMsg);
    }

    public ApprovalException(Integer approvalId, String errCode) {
        super();
        this.approvalId = approvalId;
        this.errCode = errCode;
    }

    @Override
    public String printErrMsg() {
        StringBuffer msg = new StringBuffer();

        if (StringUtils.isNotBlank(errCode)) {
            msg.append("Exception errCode is [").append(this.errCode).append("];\n");
        }

        if (approvalId != null) {
            msg.append("Exception orderId is [").append(this.approvalId).append("];\n");
        }

        return msg.toString();
    }
}
